<link rel='import' href='../../bower/polymer/polymer.html'>
<link rel='import' href='../../bower/paper-input/paper-input-decorator.html'>
<link rel='import' href='button.html'>
<link rel='import' href='../../bower/core-icons/core-icons.html'>

<polymer-element name='uproxy-description' attributes=''>
  <template>
    <style>
      paper-input-decorator {
        font-size: 14px;
        padding: 0;
        margin-bottom: 5px;
        color: rgb(112, 112, 112);
      }
      uproxy-button {
        width: 70px;
        margin-left: 0px;
        margin-right: 5px;
        font-size: 10px;
      }
      #savedDescription {
        font-size: 14px;
        color: rgb(112, 112, 112);
        padding-top: 7px;
        cursor: pointer;
      }
      #savedDescription core-icon {
        height: 16px !important;
        width: 16px !important;
        margin: 0px 0px 4px 3px;
        opacity: 0.6;
        float: right;
      }
      #savedDescription:hover core-icon {
        opacity: 1;
      }
    </style>
    <uproxy-state id="state"></uproxy-state>

    <div id='editingDescription' hidden?='{{ !editing }}'>
      <paper-input-decorator label='{{ "DESCRIPTION" | $$(model.globalSettings.language) }}'>
        <input is="core-input" value='{{ descriptionInput }}'>
      </paper-input-decorator>
      <uproxy-button raised on-tap="{{ saveDescription }}">{{ "SAVE" | $$(model.globalSettings.language) }}</uproxy-button>
      <uproxy-button raised on-tap="{{ cancelEditing }}">{{ "CANCEL" | $$(model.globalSettings.language) }}</uproxy-button>
    </div>
    <div id='savedDescription' hidden?='{{ editing }}' on-tap='{{ editDescription }}'>
      <span hidden?='{{!model.globalSettings.description}}'>{{model.globalSettings.description}}</span>
      <span hidden?='{{model.globalSettings.description}}'>{{"NAME_THIS_DEVICE" | $$(model.globalSettings.language)}}</span>
      <core-icon icon='create'></core-icon>
    </div>
  </template>
  <script src='description.js'></script>
</polymer-element>
